/**
 * 
 */
package com.technodo.utils;

import android.graphics.Color;

/**
 * @author Gaurav
 *
 */
public class TechnodoColor {
	/**
	 * Name of the color as per json specification
	 */
	private String name;

	/**
	 * Value of the color in android format
	 */
	private int value;

	/**
	 * Constructor that takes a name and maps it to a color
	 * 
	 * @param name
	 */
	public TechnodoColor(String colorName) {

		name = colorName;
		if(name.contentEquals("green") == true) {
			value = Color.GREEN;
		} else if(name.contentEquals("blue") == true) {
			value = Color.BLUE;
		} else if(name.contentEquals("red") == true) {
			value = Color.RED;
		} else if(name.contentEquals("yellow") == true) {
			value = Color.YELLOW;
		} else if(name.contentEquals("none") == true) {
			value = Color.BLACK;
		} else {
			throw new IllegalArgumentException("Color " + colorName + " not available in supported list");
		}

	}	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "TechnodoColor [name=" + name + ", value=" + value + "]";
	}	

}
